/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * tableCreate.java
 *
 * Created on 22 oct. 2010, 00:01:59
 */

package com.totoBD.gui.swing.components.dialog;

import com.totoBD.gui.swing.components.panel.PnlBtnGrpCommand;
import com.totoBD.gui.swing.components.table.TblTableCreate;
import com.totoBD.gui.wing.copmonents.spinbox.sbxTableFieldsNumber;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.WindowConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author user
 */
public class DlgConTableCreate extends DlgConAbs implements ActionListener, ChangeListener {


    public DlgConTableCreate(Frame parent, boolean modal) throws Exception {
        super( "Create a table", parent, modal);
        initComponents();
    }


    private void initComponents() {

        jLabel1 = new JLabel();
        jTextField1 = new JTextField();
        pnlCommand = new PnlBtnGrpCommand(this);
        jLabel2 = new JLabel();
        jSpinner1 = new sbxTableFieldsNumber((ChangeListener) this);
        jScrollPane1 = new JScrollPane();
        tblCreate = new TblTableCreate();


        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        

        jLabel1.setText("Name of the dable to create :");
        jTextField1.setText("Database name");
        jLabel2.setText("Number of fields :");

        jScrollPane1.setViewportView(tblCreate);

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSpinner1, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel1)
                    .addComponent(jTextField1, GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE)
                    .addComponent(pnlCommand, GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jSpinner1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 249, GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addComponent(pnlCommand, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }

    private PnlBtnGrpCommand pnlCommand;
    private JLabel jLabel1;
    private JLabel jLabel2;
    private JScrollPane jScrollPane1;
    private JSpinner jSpinner1;
    private TblTableCreate tblCreate;
    private JTextField jTextField1;

    @Override
    public void actionPerformed(ActionEvent e) {
        super.actionPerformed(e);
    }

    public void stateChanged(ChangeEvent e) {
        this.tblCreate.appendRow();


    }

    @Override
    protected boolean _doJob() throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }





}
